package com.mes_for_xxxxxx.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mes_for_xxxxxx.entity.Process;
import com.mes_for_xxxxxx.entity.common.PageInfo;
import com.mes_for_xxxxxx.entity.common.Result;
import com.mes_for_xxxxxx.entity.page.ProcessPage;
import com.mes_for_xxxxxx.service.IProcessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 工序表 前端控制器
 * </p>
 *
 * @author 179005
 * @since 2024-09-10
 */
@RestController
@RequestMapping("/process")
public class ProcessController {
    @Autowired
    IProcessService processService;



    @PostMapping("/page")
    public Result pageProcess(@RequestBody ProcessPage pageInfo){
        int pageSize = pageInfo.getPageSize();
        int pageNum = pageInfo.getPageNum();
        Page<Process>page=new Page<>(pageNum,pageSize);
        String routeId = pageInfo.getRouteId();
        QueryWrapper<Process> queryWrapper = new QueryWrapper<>();
        if(routeId!=null)
            queryWrapper.eq("route_id",routeId);
        return Result.success(processService.page(page,queryWrapper));
    }

}
